home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Collections: Franz PD
/
Franz PD Disk #334 (1994-06)(Rhein-Sieg-Soft).zip
/
Franz PD Disk #334 (1994-06)(Rhein-Sieg-Soft).adf
/
tracker.library
/
Demos
/
Window.asm
< prev
next >
Wrap
Assembly Source File
|
1994-01-09
|
6KB
|
209 lines
;TestProgramm für "tracker.library"
; Testet TRK_OpenWindow und TRK_CloseWindow
; benutzt TRK_OpenStdLibrary, TRK_Open
NOLIST
INCLUDE "exec/LVO.i"
INCLUDE "exec/memory.i"
INCLUDE "dos/LVO.i"
INCLUDE "dos/dosextens.i"
INCLUDE "intuition/LVO.i"
INCLUDE "intuition/intuition.i"
INCLUDE "tracker.i"
LIST
_TrackerBase: EQUR a5
_DosBase: EQUR a4
_IntuitionBase: EQUR a3
Output: EQUR d7
; WB-Message ?
sub.l a1,a1 ;a1=0->eigener Task
CALLEXEC FindTask ;Wo darf man denn nachschauen ?
move.l d0,a0
tst.l pr_CLI(a0) ;von CLI oder WB aus gestartet ?
bne fromCLI
;von WB aus:
lea pr_MsgPort(a0),a0
move.l a0,-(sp)
CALL WaitPort ;auf Start-Message warten
move.l (sp)+,a0
CALL GetMsg ;muß nachher beantwortet werden
move.l d0,WBenchMsg
fromCLI:
; Tracker-Library öffnen
OPENLIB TrName
tst.l d0
beq ende_all
move.l d0,_TrackerBase
TRK_OPENSTDLIB DOS,36
tst.l d0
beq ende_trk
move.l d0,_DosBase
TRK_OPENSTDLIB INTUITION,34
tst.l d0
beq ende_trk
move.l d0,_IntuitionBase
tst.l WBenchMsg
bne fromWB
;von CLI aus -> Ausgaben ins CLI-Fenster
CALLDOS Output
move.l d0,Output
bra main
;von WB aus gestartet -> eigenes Window nötig
fromWB: move.l #WdName,d1
move.l #MODE_OLDFILE,d2
CALLTRK TRK_Open
move.l d0,Output
;---------------------------------------------------------------------------
;Haupt-Testteil
OPENW: MACRO ;Adresse der NewWindow-Struktur, sichern in
lea \1,a0
bsr OpenWindow
IFNC '\2',''
move.l d0,\2
ENDC
ENDM
OPENWT: MACRO ;Adresse der NewWindow-Struktur, Start TagList, sichern in
lea \1,a0
lea \2,a1
bsr OpenWindowTags
IFNC '\3',''
move.l d0,\3
ENDC
ENDM
CLOSEW: MACRO ;wo gesichert
move.l \1,a0
bsr CloseWindow
ENDM
main: OPENW nw1,d6
OPENWT nw5,t5,d5
OPENW nw2
OPENW nw3,d4
OPENWT 0,t6,d3
CLOSEW d5
OPENWT 0,t7
CLOSEW d4
OPENW nw4,d5
CLOSEW d3
;---------------------------------------------------------------------------
;ggf. Abschieds-Message
tst.l WBenchMsg
beq ende_trk
move.l Output,d1
move.l #GoodBye,d2
move.l #GoodByeLen,d3 ;jetzt sind die Speicher-Pointer uninteressant
CALLDOS Write
move.l #150,d1
CALL Delay
;Library schließen
ende_trk:
CLOSELIB _TrackerBase
ende_all:
tst.l WBenchMsg ;war da was ?
beq toCLI ;na dann halt nicht
;Message zur WB zurück
move.l WBenchMsg,a1
CALLEXEC ReplyMsg
toCLI: moveq #0,d0
rts
;---------------------------------------------------------------------------
;Unterroutine: TRK_OpenWindowTagList testen
;Parameter: a0 = Adresse einer NewWindow-Struktur
; a1 = Adresse des 1. Tags
;Ergebnis: Adresse des geöffneten Windows / 0 bei Fehler
OpenWindowTags:
movem.l d2/d3,-(sp) ;d2/d3 sichern
CALLTRK TRK_OpenWindowTagList
move.l #OpenTagsText,d2
bra PostOpenWindow
;---------------------------------------------------------------------------
;Unterroutine: TRK_OpenWindow testen
;Parameter: a0 = Adresse einer NewWindow-Struktur
;Ergebnis: Adresse des geöffneten Windows / 0 bei Fehler
OpenWindow:
movem.l d2/d3,-(sp) ;d2/d3 sichern
CALLTRK TRK_OpenWindow
move.l #OpenText,d2
PostOpenWindow:
move.l d0,-(sp) ;d0=2. Ausgabeparameter
move.l #wd_Title,a0
move.l 0(a0,d0.l),-(sp) ;Adresse des Window-Titles==1. Parameter
move.l Output,d1
move.l sp,d3
CALLDOS VFPrintf
addq.l #4,sp ;1. Parameter löschen
move.l #200,d1
CALL Delay
movem.l (sp)+,d0/d2/d3 ;Ergebnis und d2/d3 holen
rts
;---------------------------------------------------------------------------
;Unterroutine: TRK_CloseWindow testen
;Parameter: a0 = Adresse des Windows
;Ergebnis: -
CloseWindow:
move.l a1,d0
bne 1$
rts
1$: movem.l d2/d3/a1,-(sp) ;Register sichern
CALLTRK TRK_CloseWindow
move.l Output,d1
move.l #CloseText,d2
moveq #8,d3
add.l sp,d3
CALLDOS VFPrintf
movem.l (sp)+,d2/d3/a1 ;Register zurück
rts
;---------------------------------------------------------------------------
WBenchMsg: dc.l 0
NEWWIN: MACRO ;linker, oberer Rand, Breite, Höhe, Flags, Titel
dc.w \1,\2,\3,\4
dc.b -1,-1
dc.l 0,\5,0,0,\6,0,0
dc.w 1,1,640,256,WBENCHSCREEN
ENDM
nw1: NEWWIN 10,10,300,50,WFLG_DRAGBAR|WFLG_ACTIVATE|WFLG_BORDERLESS,wt1
nw2: NEWWIN 320,10,300,70,WFLG_DEPTHGADGET|WFLG_SIZEGADGET,wt2
nw3: NEWWIN 20,130,290,60,WFLG_RMBTRAP|WFLG_SIZEGADGET|WFLG_SIZEBBOTTOM,wt3
nw4: NEWWIN 340,150,295,20,WFLG_CLOSEGADGET|WFLG_SMART_REFRESH,wt4
nw5: NEWWIN 10,70,300,11,WFLG_ACTIVATE,wt5
t5: dc.l WA_Left,15,WA_Top,55,TAG_END
t6: dc.l WA_Left,320,WA_Top,65,WA_Title,wt6
dc.l WA_Width,320,WA_Height,100,TAG_END
t7: dc.l WA_Top,320,WA_Left,200,WA_Width,320,WA_Height,25
dc.l WA_Title,wt7,WA_DragBar,1,TAG_END
TrName: TRACKERNAME
OpenTagsText: dc.b "Window ",34,"%s",34," opened with tags, Window-structure at $%06lx",10,0
OpenText: dc.b "Window ",34,"%s",34," opened, Window-structure at $%06lx",10,0
CloseText: dc.b "Window at $%06lx closed",10,0
WdName: dc.b "CON:////Window-Test für tracker.library",0
GoodBye: dc.b 10,"Bye - closing soon !"
GoodByeLen: equ *-GoodBye
wt1: dc.b "Window #1",0
wt2: dc.b "Window #2",0
wt3: dc.b "Window #3",0
wt4: dc.b "Window #4",0
wt5: dc.b "Window #5",0
wt6: dc.b "Window #6",0
wt7: dc.b "Window #7",0
END